#version 430 

layout(location = 2) uniform vec4 color;
layout(location = 3) uniform vec2 lineSize; // x thickness, y length
layout(location = 4) uniform vec4 dashStyle; //x offset, y dash, z grap, w Fuzz

in vec2 v_texCoord;

out vec4 outColor;


void main()
{
	float length = v_texCoord.x;
	float unitLength = dashStyle.y + dashStyle.z;
	float pos = mod((length + dashStyle.x), unitLength);

	float f1 = smoothstep(dashStyle.z, dashStyle.z+ dashStyle.w, pos);
	if(f1 <= 0.0)
	{
		discard;
	}

	float f2 = 1.0 - smoothstep(unitLength - dashStyle.w, unitLength, pos);

	outColor = min(vec4(1.0), color *  f1 * f2);
}